import { http } from "@/utils/http.js";

export const login = (data) => {
  return http.request({
    method: "POST",
    url: "common/login",
    data: data,
  });
};

export const send = (data) => {
  return http.request({
    method: "POST",
    url: "common/sendSms",
    data: data,
  });
};

// 推荐码
export const promoCodeApi = (data) => {
  return http.request({
    method: "get",
    url: "user/promoCode",
    params: {
      ...data,
      offLoading: true, // 加参数关闭api请求全局加载中提示
    },
  });
};

// 微信重定向
export const getOAuthUrl = (data) => {
  return http.request({
    method: "post",
    url: "/common/getOAuthUrl",
    data: {
      ...data,
      offLoading: true, // 加参数关闭api请求全局加载中提示
    },
  });
};

// 微信重定向
export const wechat = (data) => {
  return http.request({
    method: "post",
    url: "/common/wechat",
    data: {
      ...data,
      offLoading: true, // 加参数关闭api请求全局加载中提示
    },
  });
};

// 微信小程序授权

export const mini = (data) => {
  return http.request({
    method: "post",
    url: "/common/mini",
    data: {
      ...data,
      offLoading: true, // 加参数关闭api请求全局加载中提示
    },
  });
};

export const commonPhone = (data) => {
  return http.request({
    method: "post",
    url: "/common/phone",
    data: {
      ...data,
      offLoading: true, // 加参数关闭api请求全局加载中提示
    },
  });
};

//登录接口

export const appLogin = (data) => {
  return http.request({
    method: "post",

    url: "/app/login",
    data: {
      ...data,
      offLoading: true, // 加参数关闭api请求全局加载中提示
    },
  });
};

//登录接口

export const appLogout = (data) => {
  return http.request({
    method: "post",

    url: "/app/logout",
    data: {
      ...data,
      offLoading: true, // 加参数关闭api请求全局加载中提示
    },
  });
};

export const suppapiLogin = (data) => {
  return http.request({
    method: "post",

    url: "/suppapi/login",
    data: {
      ...data,
      offLoading: true, // 加参数关闭api请求全局加载中提示
    },
  });
};

//

export const loginRefresh = (data) => {
  return http.request({
    method: "post",

    url: "/app/login/refresh",
    data: {
      ...data,
      offLoading: true, // 加参数关闭api请求全局加载中提示
    },
  });
};

export const appPassword = (data) => {
  return http.request({
    method: "PATCH",
    header: {
      "Content-Type": "application/x-www-form-urlencoded",
    },
    url: "/app/password",
    data: {
      ...data,
      // offLoading: true, // 加参数关闭api请求全局加载中提示
    },
  });
};
